<?php
//+--------------------------------------------
//|描述  table  共享内存
//|--------------------------------------------
//|Created by PhpStorm.
//| Author: DRG
//+-------------------------------------------
//|Date: 2018/5/30
//| Time: 17:25
//+--------------------------------------------

//创建内存表
$table = new swoole_table(1024);

//内存表增加一列
$table->column('id' , $table::TYPE_INT, 4);
$table->column('name' , $table::TYPE_STRING, 64);
$table->column('age' , $table::TYPE_INT, 4);

$table->create();

$table->set('duruigang_imooc',['id'=> 1,'name'=>'durui','age'=>30]);

//另外一种设置值的方法
$table['duruigang_imooc'] = [
    'id'=> 2,
    'name'=>'durui2',
    'age'=>31
];

//原子操作  给age  增加2
$table->incr('duruigang_imooc', 'age', 2);
$table->decr('duruigang_imooc', 'age', 2);
//print_r($table->get('duruigang_imooc'));
//另一种获取方式
print_r($table['duruigang_imooc']);

